<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html><head>
	<title>人事管理系统——修改员工</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link href="../../css/css.css" type="text/css" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="../../js/ligerUI/skins/Aqua/css/ligerui-dialog.css">
	<link href="../../js/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="../../js/jquery-1.11.0.js"></script>
    <script type="text/javascript" src="../../js/jquery-migrate-1.2.1.js"></script>
	<script src="../../js/ligerUI/js/core/base.js" type="text/javascript"></script>
	<script src="../../js/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
	<script src="../../js/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
	<script src="../../js/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
	<link href="../../css/pager.css" type="text/css" rel="stylesheet">
	<script language="javascript" type="text/javascript" src="../../js/My97DatePicker/WdatePicker.js"></script><link href="../../js/My97DatePicker/skin/WdatePicker.css" rel="stylesheet" type="text/css">
	<script type="text/javascript">
	function sub(){
		// 控制文档加载完成以后 选中性别 
		// $("#sex").val("0");
		// $("#job_id").val("8");
		// console.log('doge');
		
    	/** 员工表单提交 */
		//$("#employeeForm").submit(function(){
		// 	alert(1);
			var sname = $("#sname");
			var scard = $("#scard");
			var seducation = $("#seducation");
			var semail = $("#semail");
			var sphone = $("#sphone");
			var stel = $("#stel");
			var spolitic = $("#spolitic");
			var sqq = $("#sqq");
			var saddress = $("#saddress");
			var szipcode = $("#szipcode");
			var sbirth = $("#sbirth");
			var snationality = $("#snationality");
			var smajor = $("#smajor");
			var shobby = $("#shobby");
			var msg = "";
			if ($.trim(sname.val()) == ""){
				msg = "姓名不能为空！";
				sname.focus();
			}else if ($.trim(scard.val()) == ""){
				msg = "身份证号码不能为空！";
				scard.focus();
			}else if (!/^[1-9]\d{16}[0-9A-Za-z]$/.test($.trim(scard.val()))){
				msg = "身份证号码格式不正确！";
				scard.focus();
			}else if ($.trim(seducation.val()) == ""){
				msg = "学历不能为空！";
				seducation.focus();
			}else if ($.trim(semail.val()) == ""){
				msg = "邮箱不能为空！";
				semail.focus();
			}else if (!/^\w+@\w{2,3}\.\w{2,6}$/.test($.trim(semail.val()))){
				msg = "邮箱格式不正确！";
				semail.focus();
			}else if ($.trim(sphone.val()) == ""){
				msg = "手机号码不能为空！";
				sphone.focus();
			}else if (!/^1[3|5|8]\d{9}$/.test($.trim(sphone.val()))){
				msg = "手机号码格式不正确！";
				sphone.focus();
			}else if ($.trim(stel.val()) == ""){
				msg = "电话号码不能为空！";
				stel.focus();
			}else if (!/^0\d{2,3}-?\d{7,8}$/.test($.trim(stel.val()))){
				msg = "电话号码格式不正确！";
				stel.focus();
			}else if ($.trim(spolitic.val()) == ""){
				msg = "政治面貌不能为空！";
				spolitic.focus();
			}else if ($.trim(sqq.val()) == ""){
				msg = "QQ号码不能为空！";
				sqq.focus();
			}else if (!/^\d{6,}$/.test($.trim(sqq.val()))){
				msg = "QQ号码格式不正确！";
				sqq.focus();
			}else if ($.trim(saddress.val()) == ""){
				msg = "地址不能为空！";
				saddress.focus();
			}else if ($.trim(szipcode.val()) == ""){
				msg = "邮政编码不能为空！";
				szipcode.focus();
			}else if (!/^[1-9]\d{5}$/.test($.trim(szipcode.val()))){
				msg = "邮政编码格式不正确！";
				szipcode.focus();
			}else if ($.trim(sbirth.val()) == ""){
				msg = "出生日期不能为空！";
				sbirth.focus();
			}else if (!sbirth.val()){
//					!/^\d{4}-\d{2}-\d{2}$/.test($.trim(birthday.val()))
				msg = "出生日期格式不正确！";
				sbirth.focus();
			}else if ($.trim(snationality.val()) == ""){
				msg = "民族不能为空！";
				snationality.focus();
			}else if ($.trim(smajor.val()) == ""){
				msg = "专业不能为空！";
				smajor.focus();
			}else if ($.trim(shobby.val()) == ""){
				msg = "爱好不能为空！";
				shobby.focus();
			}
			if (msg != ""){
				$.ligerDialog.error(msg);
				return false;
			}else{
				return true;
			}
			//$("#employeeForm").submit();
		//});
    }
		

	</script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tbody><tr><td height="10"></td></tr>
  <tr>
    <td width="15" height="32"><img src="../../images/main_locleft.gif" width="15" height="32"></td>
	<td class="main_locbg font2"><img src="../../images/pointer.gif">&nbsp;&nbsp;&nbsp;当前位置：员工管理  &gt; 修改员工</td>
	<td width="15" height="32"><img src="../../images/main_locright.gif" width="15" height="32"></td>
  </tr>
</tbody></table>
<form action="updateEmp.action" method="post" onsubmit="return sub();">
<table width="100%" height="90%" border="0" cellpadding="5" cellspacing="0" class="main_tabbor">
  <tbody><tr valign="top">
    <td>
    	
			<!-- 隐藏表单，flag表示添加标记 -->
    	 	<input type="hidden" name="flag" value="2">
			<input type="hidden" name="id" value="1">
		  <table width="100%" height="90%" border="0" cellpadding="5" cellspacing="0" class="main_tabbor">
  <tbody><tr valign="top">
    <td>
    	
			<!-- 隐藏表单，flag表示添加标记 -->
    	 	<input type="hidden" name="flag" value="2">
			<input type="hidden" name="sid" value="${emp.sid}">
		  <table width="100%" border="0" cellpadding="0" cellspacing="10" class="main_tab">
		    <tbody><tr><td class="font3 fftd">
		    	<table>
		    		<tbody><tr>
		    			<td class="font3 fftd">姓名：<input type="text" name="sname" id="sname" size="20" value="${emp.sname}"></td>
		    			<td class="font3 fftd">身份证号码：<input type="text" name="scard" id="scard" size="20" value="${emp.scard}"></td>
		    		</tr>
		    		<tr>
		    			<td class="font3 fftd">性别：
								<select id="sgender" name="sgender" style="width:143px;">
									<option value="1" ${1 == emp.sgender ? "selected" : ""}>男</option>
									<option value="2" ${2 == emp.sgender ? "selected" : ""}>女</option>
<%--									<option value="3" ${3 == emp.sgender ? "selected" : ""}>保密</option>--%>
					    		</select>
					    </td>
		    			<td class="font3 fftd">职&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;位：
		    			 	<select id="pos.pid" name="pos.pid" style="width:143px;">
								<c:forEach items="${positions}" var="pos">
									<option value="${pos.pid}" ${pos.pid == emp.pos.pid ? "selected" : ""}>${pos.pname}</option>
								</c:forEach>
							</select>
					    </td>
		    		</tr>
		    		<tr>
		    			<td class="font3 fftd">学历：<input name="seducation" id="seducation" size="20" value="${emp.seducation}"></td>
		    			<td class="font3 fftd">邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱：<input name="semail" id="semail" size="20" value="${emp.semail}"></td>
		    		</tr>
		    		<tr>
		    			<td class="font3 fftd">手机：<input name="sphone" id="sphone" size="20" value="${emp.sphone}"></td>
		    			<td class="font3 fftd">电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;话：<input name="stel" id="stel" size="20" value="${emp.stel}"></td>
		    		</tr>
		    		
		    	</tbody></table>
		    </td></tr>
			<tr><td class="main_tdbor"></td></tr>
			
			<tr>
				<td class="font3 fftd">
					政治面貌：<input name="spolitic" id="spolitic" size="40" value="${emp.spolitic}">&nbsp;&nbsp;
					QQ&nbsp;&nbsp;号码：<input name="sqq" id="sqq" size="20" value="${emp.sqq}">
				</td>
			</tr>
			<tr><td class="main_tdbor"></td></tr>
			
			<tr>
				<td class="font3 fftd">
					联系地址：<input name="saddress" id="saddress" size="40" value="${emp.saddress}">&nbsp;&nbsp;
					邮政编码：<input name="szipcode" id="szipcode" size="20" value="${emp.szipcode}">
				</td>
			</tr>
			<tr><td class="main_tdbor"></td></tr>
			
			<tr>
				<td class="font3 fftd">
					出生日期：<input cssclass="Wdate" onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'});" name="sbirth" id="sbirth" size="40" value="${emp.sbirth}">&nbsp;&nbsp;
					民&nbsp;&nbsp;&nbsp;&nbsp;族：<input name="snationality" id="snationality" size="20" value="${emp.snationality}">
				</td>
			</tr>
			<tr><td class="main_tdbor"></td></tr>
			
			<tr>
				<td class="font3 fftd">
					所学专业：<input name="smajor" id="smajor" size="40" value="${emp.smajor}">&nbsp;&nbsp;
					爱&nbsp;&nbsp;&nbsp;&nbsp;好：<input name="shobby" id="shobby" size="20" value="${emp.shobby}">
				</td>
			</tr>
			<tr><td class="main_tdbor"></td></tr>
			
			<tr>
				<td class="font3 fftd">
					备&nbsp;&nbsp;&nbsp;&nbsp;注：<input name="sremark" id="sremark" size="40" value="${emp.sremark}">
					&nbsp;&nbsp;所属部门：
					<select name="department.did" style="width:100px;">
						<c:forEach items="${departments}" var="dept">
							<option value="${dept.did}" ${dept.did == emp.department.did ? "selected" : ""}>${dept.dname}</option>
						</c:forEach>
					</select>
				</td>
			</tr>
			<tr><td class="main_tdbor"></td></tr>
			
			<tr><td align="left" class="fftd"><input type="submit"  value="修改">&nbsp;&nbsp;<input type="reset" value="取消 "></td></tr>
		  </tbody></table>
	
	</td>
  </tr>
</tbody></table>
		
	</td>
  </tr>
</tbody></table>
</form>
<div style="height:10px;"></div>

</body></html>